<?php
 header ('Content-type: text/html; charset=utf-8');
 //echo " rec db/ <br />";
 require_once 'db.php';
 //echo "rec def/ <br /> ";
 require_once 'defines.php';
 //echo "rec gb/ <br /> ";
 require_once 'gb.php';
 //echo "rec template/ <br /> ";
 require_once 'template.php';
 //echo "db_con <br /> ";

 db_connect(DBHOST, DBUSER, DBPASSWD, DBNAME) or die('dbcon'.mysql_error());
 
 $comentname=$_POST['comentname'];
 $coment=$_POST['coment'];



//добавление комментария
if(@$_GET['comentname'] && @$_GET['coment'] && @$_GET['messageid'])
{
	gb_addcoment($_GET['messageid'], $_GET['coment'], $_GET['comentname']);
	header('Location: '.PATH."index.php?page=1");
}


//вывод комментариев
if(@$_GET['messageid'])
{
template_comentform(intval($_GET['messageid']),$coment,$comentname,$error);
}
else {
	//	echo "index";
	header('Location: '.PATH."index.php?page=1");
}



?>